//
//  ClearFB.m
//  HAODE
//
//  Created by LiYinDi on 16/4/1.
//  Copyright © 2016年 reabam.com. All rights reserved.
//

#import "ClearFB.h"
#import "FMDB.h"

@implementation ClearFB
static  FMDatabase * _userDB;
+(void)initialize
{
    NSString *dbPath = [self getDBPath];
    _userDB = [FMDatabase databaseWithPath:dbPath];
    if (![_userDB open]) {
        NSLog(@"open membersDB failed");
        return;
    }

}
+(void)clearUserData:(NSString *)userToken typeString:(NSString *)typeString
{
    [_userDB executeUpdate:@"DELETE FROM t_UserPlaceOrder WHERE userToken = ? AND typeString  = ?",userToken,typeString];
    [_userDB executeUpdate:@"DELETE FROM t_UserSpec WHERE userToken = ? AND typeString  = ?",userToken,typeString];
    

}
+(NSString *)getDBPath
{
    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    NSString *DBPath = [documentPath stringByAppendingPathComponent:kUserDBNAME];
    
    return DBPath;
}
@end
